﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace Pacocation
{
    class Bola
    {
        Texture2D bola;
        public int posicaox, posicaoy;
        public Rectangle rectBola;

        public Bola(ContentManager Content)
        {
            bola = Content.Load<Texture2D>("ball");
            rectBola = new Rectangle(505,525, bola.Width, bola.Height);
            posicaox = 5;
            posicaoy = 5;
        }

        public void Update(GameTime gameTime)
        {
            
            if (rectBola.X <= 230)
            {
                posicaox = -5;
            }

            if (rectBola.X >= (800 - bola.Width))
            {
                posicaox = 5;
            }

            if (rectBola.Y <= 0)
            {
                posicaoy = -5;
            }

           
            
            rectBola = new Rectangle(rectBola.X - posicaox, rectBola.Y - posicaoy, bola.Width, bola.Height);
        }

        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Begin();
            spriteBatch.Draw(bola, rectBola, Color.White);
            spriteBatch.End();
        }
    }
}
